#ifndef QLIST_BOOST_H
#define QLIST_BOOST_H

#include "boost/serialization/serialization.hpp"
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include "boost/serialization/list.hpp"

namespace boost {
    namespace serialization {

        //---------------------------------------------------------------------------
        /// Sauvegarder une QList d'objets dans une collection
        template<class Archive, class U >
        inline void save(Archive &ar, const QList< U > &t, const uint )
        {
            boost::serialization::stl::save_collection< Archive, QList<U> >(ar, t);
        }

        //---------------------------------------------------------------------------
        /// Charger une QList d'objets dans une collection
        template<class Archive, class U>
        inline void load(Archive &ar, QList<U > &t, const uint )
        {
                boost::serialization::stl::load_collection<
                    Archive,
                    QList<U>,
                    boost::serialization::stl::archive_input_seq<Archive, QList<U> >,
                    boost::serialization::stl::no_reserve_imp< QList<U> > >(ar, t);
        }

        //---------------------------------------------------------------------------
        /// On sépare la sérialisation dans une fonction non instrusive.
        template<class Archive, class U >
        inline void serialize(Archive &ar, QList<U> &t, const uint file_version )
        {
            boost::serialization::split_free( ar, t, file_version);
        }

    }
}

BOOST_SERIALIZATION_COLLECTION_TRAITS(QList)

#endif // QLIST_BOOST_H
